package com.yunform.framework.util.js;

import javax.script.ScriptException;

public class JavaScriptExecuteException extends Exception {
	private String action;
	private String message;
	private String lineSource;
	private String script;
	private ScriptException e;
	/**
	 * 
	 */
	private static final long serialVersionUID = 7447909597633841592L;

	public JavaScriptExecuteException(String action,String script,ScriptException e) {
		this.action = action;
		this.message  = e.getMessage().replaceFirst("sun.org.mozilla.javascript.internal.EcmaError:", "");
//		this.lineSource = e.getColumnNumber()
//		if( e.getCause() instanceof sun.org.mozilla.javascript.internal.EvaluatorException){
//			sun.org.mozilla.javascript.internal.EvaluatorException ee = (sun.org.mozilla.javascript.internal.EvaluatorException)e.getCause();
//			this.message = ee.getMessage() +"在"+ee.getColumnNumber()+"列";
//			this.lineSource = ee.getLineSource();
//		}else{
//			this.message  = e.getMessage();
//		}
		this.script = script;
		super.setStackTrace(e.getStackTrace());
		this.e = e;
	}

	public String getScript() {
		return script;
	}

	public void setScript(String script) {
		this.script = script;
	}

	public ScriptException getE() {
		return e;
	}

	public void setE(ScriptException e) {
		this.e = e;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public String getLineSource() {
		return lineSource;
	}

	public void setLineSource(String lineSource) {
		this.lineSource = lineSource;
	}

	public String getAction() {
		return action;
	}

	public void setAction(String action) {
		this.action = action;
	}

	
}
